home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Professional Soft Collection 1.02
/
Professional Soft Collection 1.02.iso
/
winutils
/
wingauge.zip
/
INTEGR4.C
< prev
next >
Wrap
C/C++ Source or Header
|
1993-01-19
|
2KB
|
59 lines
#pragma option -zC_ABOUT
#pragma hdrfile "WinGauge.SYM"
#include <win31.h>
#include "wingauge.h"
#include "wingauge.rh"
#pragma hdrstop
BOOL FAR PASCAL AboutDlgProc( HWND hDlg, WORD iMessage, WORD wParam,
LONG lParam )
{ static HBRUSH hBrush;
static HICON hIcon;
static HWND hDlgIcon;
PAINTSTRUCT ps;
POINT point;
char cBuffer[80];
HDC hDC;
switch( iMessage )
{ case WM_INITDIALOG:
// Prepare brush for dialog background
hBrush = CreateSolidBrush( LIGHTGRAY );
// Prepare icon for dialog box
hIcon = LoadIcon( hInst, MAKEINTRESOURCE( LOWORD(lParam)+1 ) );
// Get icon template window handle
hDlgIcon = GetDlgItem( hDlg, IDD_ICON );
// Set panel name (or NULL) in dialog
LoadString( hInst, LOWORD(lParam)+1, cBuffer, sizeof(cBuffer) );
SetDlgItemText( hDlg, IDD_NAME, cBuffer );
return TRUE; // Set focus to OK button
case WM_CTLCOLOR: // Select color for background paint
SetBkColor( wParam, LIGHTGRAY );
UnrealizeObject( hBrush );
point.x = point.y = 0;
ClientToScreen( hDlg, &point );
SetBrushOrg( wParam, point.x, point.y );
return hBrush;
case WM_PAINT:
BeginPaint( hDlg, &ps );
EndPaint( hDlg, &ps );
hDC = GetDC( hDlgIcon );
DrawIcon( hDC, 0, 0, hIcon ); // Draw icon for current panel
ReleaseDC( hDlgIcon, hDC );
ValidateRect( hDlgIcon, NULL );
return TRUE;
case WM_COMMAND:
if( wParam == IDOK || wParam == IDCANCEL )
{ EndDialog( hDlg, 0 );
DeleteObject( hBrush ); // Clearance!
FreeResource( hIcon );
return TRUE;
}
}
return FALSE;
}